<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="jquery1.9/jquery-1.9.0.js"></script>
    <style>
        .container{
            width:600px;
            height:400px;
            border:1px solid #ccc;
        }
        .mydiv{
            width:80px;
            height: 80px;
        }
    </style>
</head>
<body>
    <input type="button" value="开始" onclick="doMove()">
    <div class="container">
        <div class="mydiv d1"><img src="images/heihei.gif" alt=""></div>
        <div class="mydiv d2"><img src="images/heihei.gif" alt=""></div>
        <div class="mydiv d3"><img src="images/heihei.gif" alt=""></div>
        <div class="mydiv d4"><img src="images/heihei.gif" alt=""></div>
        <div class="mydiv d5"><img src="images/heihei.gif" alt=""></div>
    </div>
    <script>
        function doMove(){
            //获取jQuery对象
            var d1=$(".d1");
            var d2=$(".d2");
            var d3=$(".d3");
            var d4=$(".d4");
            var d5=$(".d5");
            d1.animate({"margin-left":"100px"},1000,function(){
                d2.animate({"margin-left":"200px"},1000,function(){
                    d3.animate({"margin-left":"300px"},1000,function(){
                        d4.animate({"margin-left":"400px"},1000,function(){
                            d5.animate({"margin-left":"500px"},1000,function(){
                                d5.animate({"margin-left":"0px"},1000,function(){
                                    d4.animate({"margin-left":"0px"},1000,function(){
                                        d3.animate({"margin-left":"0px"},1000,function(){
                                            d2.animate({"margin-left":"0px"},1000,function(){
                                                d1.animate({"margin-left":"0px"},1000,function(){
                                                    console.log("执行结束");
                                                });
                                            });
                                        });
                                    });
                                });
                            });
                        });
                    });
                });
            });
        }
    </script>
</body>
</html>